package com.example.capsule_chat0322.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentResultListener;

import com.example.capsule_chat0322.R;

/**
 * @Author zhuzhiming
 * @Date 2022/5/1 14:06
 */
public class ChatRoomFragment extends Fragment {

    private boolean isFirst = true;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getParentFragmentManager().setFragmentResultListener("skipToChatRoomListMark", this, new FragmentResultListener() {
            @Override
            public void onFragmentResult(@NonNull String requestKey, @NonNull Bundle bundle) {
                String result = bundle.getString("isSkip");
                if (result != null) {
                    isFirst = false;
                }
            }
        });

        Bundle result = new Bundle();
        result.putString("isSkip", "true");
        getParentFragmentManager().setFragmentResult("skipToChatRoomListMark", result);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.chat_room, container, false);
    }

}
